import request from '@/router/axios';

export const getList = (page, size, params) => {
  return request({
    url: '/cms/cmsArticle/list',
    method: 'post',
    params: {
      ...params,
      page,
      size,
    }
  })
}

export const getDetail = (id) => {
    return request({
        url: '/cms/cmsArticle/detail',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data: {
            id,
        }
    })
}

export const remove = (id) => {
  return request({
    url: '/cms/cmsArticle/delete',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      id,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/cms/cmsArticle/addItem',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/cms/cmsArticle/editItem',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const getSelectList = (sysFlag) => {
    return request({
        url: '/cms/cmsArticleClass/listsDicData',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data: {
            sysFlag,
        }
    })
}


export const getTree = (sysFlag) => {
    return request({
        url: '/cms/cmsArticleClass/getTree',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data: {
            sysFlag,
        }
    })
}

export const removeAll = (ids) => {
    return request({
        url: '/cms/cmsArticle/removeAll',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data: {
            ids,
        }
    })
}


export const changeStatus = (userId, status) => {
  return request({
    url: '/cms/cmsArticle/changeStatus',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      userId,
      status
    }
  })
}

export const listStoreManage = (data) => {
    return request({
        url: '/base/store/getCmsUser',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data:data
    })
}

export const mgrList = (data) => {
    return request({
        url: 'base/user/getBranchLeader',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data:data
    })
}

export const addItem = (data) => {
    return request({
        url: '/cms/articleRecord/addItem',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data:data
    })
}

export const getRecord = (data) => {
    return request({
        url: '/cms/articleRecord/getRecord',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data:data
    })
}
export const getAdminRecord = (data) => {
    return request({
        url: '/cms/articleRecord/getAdminRecord',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data:data
    })
}